#pragma once
#include "time.h" 
#include "stdio.h" 
#include "cocos2d.h"
#include "EnemyManager.h"

using namespace cocos2d;

#define MAX_WAVE 100
#define MAX_ENEMY 40

//#define ENEMY_SPAWN_INTERVAL 5.0f
//#define ENEMY_SPAWN_NUM 2
//#define ENEMY_WAVE_COUNT 5

class WaveData
{
public:
	int currentWave;
	int getMoney;
	int kill;
	int damage;
	int hit;
	int getDamage;
	time_t startTime; 
};

class OneEnemy : public CCObject
{
public:
	EEnemyType d_type;
	CCPoint d_pos;// y: 1-5(top-bottom)  x:1,2...(right of screen)
};

class GroupData : public CCObject
{
public:
	float d_delay;
	CCArray* d_enemyData;
};

class WaveManager : public CCLayer
{
	CC_SYNTHESIZE(bool, isSpawnEnd, IsSpawnEnd)

public:
	WaveManager(CCLayer* layer);
	~WaveManager(void);
	void startWave();
	void waveEnded();
	void killed(int money, int hp);
	void hitted(int damage);

	void showWave();
	void showBoss(float dt);
	void waveMsgEnd(CCNode* sender);

	const WaveData& getWaveData();
private:
	void spawnEnded();
	void spawnEnemys();
	void spawnGroup();
	void spawnBoss(float dt);
	void reSchedule(float delay);
	CCLayer* _layer; // necesarry?
	CCSize _winSize;

	WaveData data;

	CCLabelTTF* waveLabel;

	CCArray* waveData;
	unsigned int currentGroup;
	GroupData* currentGData;
};

